home *** CD-ROM | disk | FTP | other *** search
- ;;; -*- Scheme -*-
-
- #|
- Description:
-
- This code tests fixnum binary arithmetic and division:
- The procedures may be open-coded, or special utilities
- may be used instead.
-
- Usage:
- Try each of them as if they were fix:lsh, etc., etc.
- Make sure, in particular, that quotient and lsh work for negative
- arguments:
-
- (my-quotient -1 4) -> 0
- (my-lsh -1 -2) -> <a positive number>
-
- |#
-
- (declare (usual-integrations))
-
- (define (my-lsh x y)
- (fix:lsh x y))
-
- (define (my-lsh-6 x)
- (fix:lsh x -6))
-
- (define (my-lsh+6 x)
- (fix:lsh x 6))
-
- (define (my-lsh*6 x)
- (fix:lsh 6 x))
-
- (define (my-quotient x y)
- (fix:quotient x y))
-
- (define (my-quotient-64 x)
- (fix:quotient x -64))
-
- (define (my-quotient+64 x)
- (fix:quotient x 64))
-
- (define (my-quotient*64 x)
- (fix:quotient 64 x))
-
- (define (my-remainder x y)
- (fix:remainder x y))
-
- (define (my-remainder-64 x)
- (fix:remainder x -64))
-
- (define (my-remainder+64 x)
- (fix:remainder x 64))
-
- (define (my-remainder*64 x)
- (fix:remainder 64 x))
-
- ;; Bitwise
-
- (define (my-not x)
- (fix:not x))
-
- (define (my-and x y)
- (fix:and x y))
-
- (define (my-and/c x)
- (fix:and #b101010101 x))
-
- (define (my-and\c x)
- (fix:and x #b101010101))
-
- (define (my-andc x y)
- (fix:andc x y))
-
- (define (my-andc/c x)
- (fix:andc #b101010101 x))
-
- (define (my-andc\c x)
- (fix:andc x #b101010101))
-
- (define (my-or x y)
- (fix:or x y))
-
- (define (my-or/c x)
- (fix:or #b101010101 x))
-
- (define (my-or\c x)
- (fix:or x #b101010101))
-
- (define (my-xor x y)
- (fix:xor x y))
-
- (define (my-xor/c x)
- (fix:xor #b101010101 x))
-
- (define (my-xor\c x)
- (fix:xor x #b101010101))